package ls.test;

import ls.dao.CourseDAO;
import ls.dao.DAOFactory;
import ls.dao.EvaluateDAO;
import ls.entity.Course;
import ls.entity.Evaluate;
import ls.entity.Student;

import java.util.Scanner;

public class StudentEvaluate {
    CourseDAO courseDAO = DAOFactory.getInstance().getCourseDAO();
    EvaluateDAO evaluateDAO = DAOFactory.getInstance().getEvaluateDAO();
    public int studentEvaluate(Student student)
    {
        String course_name = student.getCourse();
        Course course = courseDAO.look(course_name);
        System.out.println("研究生您好，请您填写助教工作评定表的“授课时间”和“助教工作自述”");
        Scanner scanner = new Scanner(System.in);
        System.out.println("授课时间：");
        String time = scanner.next();
        System.out.println("助教工作自述：");
        String work = scanner.next();
        Evaluate evaluate = new Evaluate();
        evaluate.setStudent_id(student.getStudent_id());
        evaluate.setStudent_name(student.getStudent_name());
        evaluate.setCourse_name(course_name);
        evaluate.setNumber(course.getNumber());
        evaluate.setStudent_major(student.getStudent_major());
        evaluate.setCourse_property(course.getCourse_property());
        evaluate.setCourse_student(course.getCourse_student());
        evaluate.setCourse_teacher(course.getCourse_teacher());
        evaluate.setTeach_time(time);
        evaluate.setStudent_work(work);
        evaluate.setTeacher_id(course.getTeacher_id());
        evaluate.setResult("待审核");
        evaluateDAO.addEvaluate(evaluate);
        System.out.println("评定表提交成功，请等待授课教师审核");
        ChooseCourse chooseCourse = new ChooseCourse();
        int m = chooseCourse.middle(student.getStudent_id());
        if(m==0) return 0;
        return 0;
    }
    public void lookEvaluate(Evaluate evaluate)
    {
        System.out.println("您的评定表内容为：");
        System.out.print("研究生姓名："+evaluate.getStudent_name());
        System.out.print("    研究生学号："+evaluate.getStudent_id());
        System.out.println();
        System.out.print("课程名称："+evaluate.getCourse_name());
        System.out.print("    授课人数："+evaluate.getNumber());
        System.out.println();
        System.out.print("课程性质："+evaluate.getCourse_property());
        System.out.print("    授课对象："+evaluate.getCourse_student());
        System.out.println();
        System.out.print("授课教师："+evaluate.getCourse_teacher());
        System.out.print("    授课时间："+evaluate.getTeach_time());
        System.out.println();
        System.out.println("助教工作自述："+evaluate.getStudent_work());
        System.out.println("教师评价结果："+evaluate.getResult());
    }
}
